﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Settings.ascx.cs" Inherits="Controls_Settings" %>
<!-- table -->
<div class="box">
    <!-- box / title -->
    <div class="title">
        <h5 runat="server" id="title">
            Cấu hình hệ thống</h5>
        <div class="search">
            <div class="input">
                <asp:DropDownList ID="ddlSettingGroups" runat="server">
                </asp:DropDownList>
            </div>
            <div class="button">
                <asp:Button ID="btnSearch" runat="server" Text="Tiếp tục" OnClick="btnSearch_Click" />
            </div>
        </div>
    </div>
    <div id="divMessage" runat="server">
    </div>
    <!-- end box / title -->
    <div class="table">
        <table>
            <thead>
                <tr>
                    <th>
                        STT
                    </th>
                    <th>
                        Tên cấu hình
                    </th>
                    <th>
                        Giá trị
                    </th>
                    <th>
                        Ngày tạo
                    </th>
                    <th>
                        Sửa
                    </th>
                    <th class="last">
                        Xóa
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:Repeater ID="rptData" runat="server" OnItemCommand="rptData_ItemCommand">
                    <ItemTemplate>
                        <tr>
                            <td align="center">
                                <%#Container.ItemIndex+1%>
                            </td>
                            <td align="center">
                                <%#Eval("SETTING_NAME")%>
                                <asp:Button ID="btnID" runat="server" CommandArgument='<%#Eval("SETTING_ID")%>' Visible="false" />
                            </td>
                            <td align="center">
                                <%#LibraryO2S.O2S_StringUtil.Substring(Eval("SETTING_VALUE").ToString(),0,50)%>
                            </td>
                            <td align="center">
                                <%#LibraryO2S.O2S_DateTime.dd_MM_yyyy(Convert.ToDateTime(Eval("CREATED_DATE")))%>
                            </td>
                            <td align="center">
                                <a href='<%#"default.aspx?module=settingedit&s_id="+Eval("SETTING_ID")%>' title="Chỉnh Sửa">
                                    <img src="../Resources/icons/16x16/edit.png" class="icon-32-edit" />
                                </a>
                            </td>
                            <td class="last" align="center">
                                <asp:Button runat="server" ID="btnDel" CssClass="icon-32-delete" CommandName="del"
                                    CommandArgument='<%#Eval("SETTING_ID")%>' BackColor="Transparent" BorderStyle="None"
                                    OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không ?');" />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
        </table>
        <div class="action">
            <div class="button">
                <asp:Button ID="btnNew" runat="server" Text="Thêm Mới" OnClick="btnNew_Click" />
            </div>
        </div>
      <div style="text-align: center; margin: 10px">
            <%if (Session["url"] != null)
              {
                  if (Request.UrlReferrer != null)
                  {
                      if (!Request.UrlReferrer.ToString().Equals(Request.Url.ToString()))
                      {
                          Session["url"] = Request.UrlReferrer.ToString();                      
                  
            %>
            <a onclick="history.go(-1);" title="Trang trước">
                <%
}
                      else
                      {
                %>
                <a href='<%=Session["url"].ToString() %>' title="Trang trước">
                    <%   
}
                  }
                  else
                  {                      
                    %>
                    <a onclick="history.go(-1);" title="Trang trước">
                        <%}
              }
              else
              {
                  if (Request.UrlReferrer != null)
                      Session.Add("url", Request.UrlReferrer.ToString());
                  else
                      Session.Add("url", Request.Url.ToString());
                        %>
                        <a href="default.aspx" title="Trang trước">
                            <%} %>
                            <img src="../resources/images/icons/16x16/arrow-return.png" alt="Trang trước" /></a>
                        &nbsp;&nbsp; <a href="default.aspx" title="Trang chủ">
                            <img src="../resources/images/icons/16x16/home.png" alt="Trang chủ" /></a>
        </div>
    </div>
</div>
<!-- end table -->
